package com.kingsoft.dc.khaos.module.spark.util;

import okhttp3.OkHttpClient;
import org.influxdb.InfluxDB;
import org.influxdb.impl.InfluxDBImpl;
import org.influxdb.impl.Preconditions;

import java.util.Objects;

/**
 * Created by wuxiang on 2021/1/7.
 */
public enum InfluxDBFactory {
    INSTANCE;

    public static InfluxDB connect(final String url, final String username, final String password,
                                   final OkHttpClient.Builder client) {
        Preconditions.checkNonEmptyString(url, "url");
        Preconditions.checkNonEmptyString(username, "username");
        Preconditions.checkNonEmptyString(password, "password");
        Objects.requireNonNull(client, "client");
        return new InfluxDBImpl(url, username, password, client);
    }
}
